import { defineStore } from 'pinia';


export const usePageDecoration = defineStore('usePageDecoration', {
	state: () => {
		return {
			value: null,
		};
	},
	actions: {
		setData(value) {
			if (this.value) {
				this.value = Object.assign(this.value, value);
			} else {
				this.value = value;
			}
		},
		// 将state 重置为初始值
		claerData() {
			this.$reset();
		},
		getPageConfig(page) {
			return this.value ? this.value[page] : [];
		},
		minxinData(field, value) {
			if (this.value) {
				this.value = Object.assign(this.value, {
					[field]: value
				});
			} else {
				this.value = {
					[field]: value
				};
			}
		},
	},
});